#include <cstdio>
#include <cmath>

typedef unsigned int uint;


inline uint divisors (uint n)
{
	uint d, r, c, sn;

	r = 1;
	d = 2;
	sn = sqrt (n);

	for (d = 2; d <= sn; ++d)
	{
		if (n % d == 0)
			++r;
	}

	r += r;
	r -= (sn * sn == n);

	return r;
}


int main ()
{
	uint test_cases, l, u, max_divisors, n, d;

	scanf ("%u", &test_cases);
	while (test_cases--)
	{
		scanf ("%u %u", &l, &u);
		printf("Between %u and %u, ", l, u);
		max_divisors = 0;

		for (; l <= u; ++l)
		{
			d = divisors (l);
			if (max_divisors < d)
			{
				max_divisors = d;
				n = l;
			}
		}

		printf("%u has a maximum of %u divisors.\n", n, max_divisors);
	}

	return 0;
}